#include "TcpServer.hpp"
#include "Http.hpp"
#include <functional>

void Usage(const std::string &tip)
{
    std::cout << "Please Use:\n\t" << tip << " local_port\n"
              << std::endl;
}


int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }

    uint16_t port = std::stoi(argv[1]);

    HttpServer httpserver;
    TcpServer tcpserver(port,std::bind(&HttpServer::HandlerHttpRequest,&httpserver,std::placeholders::_1));

    tcpserver.Loop();

    return 0;
}